
#ifndef _TTG_DEVICES_REF_INITER_
#define _TTG_DEVICES_REF_INITER_
#include "Common/Definitions.h"

#include "CPU/CPU.h"
#include "GPU/GPU.h"

namespace ttg_internal
{
	namespace devices
	{
		//Checks all references.
		class RefIniter
		{
			public:
				//Throws ttg::Error in case of uninited reference.
				static inline void check()
				{
					if (ttg::devices::CPU::getRef() == NULL ||
						ttg::devices::CPU::x86::getRef() == NULL ||
						ttg::devices::GPU::getRef() == NULL ||
						ttg::devices::GPU::CUDA::getRef() == NULL)
						throw ttg::Error(ttg::Error::FATAL, "RefInitier", "check",
										 "Internal error: your CPU has been stolen!");
				}
		};
	}
}

#endif
